#ifndef INTERRUPT_H
#define INTERRUPT_H

#include"os_type.h"
class InterruptManager
{
private:
	//IDT的起始地址
	uint32 *IDT;
	
	uint32 IRQ0_8259A_MASTER;//主片中断起始向量号
	uint32 IRQ0_8259A_SLAVE;//从片中断起始向量号
	
	void initialize8259A();//初始化8259A芯片
	
	
public:
	InterruptManager();
	void initialize();//初始化
	//设置中断描述符
	//index 第 index 个描述符，0，1，,...,255
	//address 中断处理程序的起始地址
	//dpl 中断描述符的特权级
	void setInterruptDescriptor(uint32 index,uint32 address,byte DPL);
	
	void enableTimeInterrupt();//开启时钟中断
	void disableTimeInterrupt();//禁止时钟中断
	void setTimeInterrupt(void* handler);//设置时钟中断处理函数

	void enableKeyboardInterrupt();//键盘中断
	void disableKeyboardInterrupt();
	void setKeyboardInterrupt(void* handler);

	void enableInterrupt();
	void disableInterrupt();
	bool getInterruptStatus();//获取中断状态
	void setInterruptStatus(bool status);	

};

#endif
